package com.thz.houserental.domain.tenant;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/tenant")
@Tag(name = "租户管理")
public class TenantController {
    private final TenantService tenantService;

    public TenantController(TenantService tenantService) {
        this.tenantService = tenantService;
    }

    @Operation(summary = "入住登记") 
    @PostMapping("/register")
    @Transactional
    public void tenantRegister(@RequestBody Tenant tenant) {
        this.tenantService.register(tenant);
    }
    
    @Operation(summary = "退房办理")
    @DeleteMapping("/checkOut")
    @Transactional
    public void checkOut(@RequestBody Tenant tenant) {
        this.tenantService.checkOut(tenant);
    }
}
